package threadLocalMap;

/**
 * @author Fang Ruichuan
 * @date 2022-12-28 20:55
 */

public class APITests {
    public static ThreadLocal<Long> threadLocal = ThreadLocal.withInitial(() -> {
        System.out.println("Initail Value run...");
        return Thread.currentThread().getId();
    });

    public static void main(String[] args) {
        new Thread(() -> {
            System.out.println("main new Thread " + Thread.currentThread().getName() + ":" + threadLocal.get());
        }).start();
        threadLocal.set(6L);
        System.out.println("main " + Thread.currentThread().getName() + ":" + threadLocal.get());
    }
}
